/**
 * 在线考试系统首页脚本
 * Created by 2017-09-18
 */
$(function(){
	
	
	//获取所有考试信息box
	var examRooms = $(".examRoom");
	$.each(examRooms,function(index){
		var $room = $(this);
		var $labels = $room.find('label');
		for(var i = 0;i <$labels.length;i++ ){
			if($labels[i].innerText == student_class){
				$room.find("button").prop("disabled",false);
			}
		}
	});
	examRooms.delegate("button","click",function(){
		var $labels = $(this).prev().children("label");
		var i = 0;
		for(; i < $labels.length;i++){
			if(student_class == $labels[i].innerText){
				var examroom_id = $($labels[i]).parents(".examRoom").attr("exam-room-id");
				var paper_id = $($labels[i]).parents(".examRoom").attr("exam-paper-id");
				//var student_exam_id = $(this).attr("student-exam-id");
				location.href="/axems/front/student/guize/"+examroom_id+"/"+paper_id;//+"/"+student_exam_id;
				break;
			}
		}
		if(i == $labels.length)
			swal({
				title: '警告',
				text: '请规范你的行为,认真对待考试!',
				type: 'warning',
				confirmButtonText: '知道了'
			});
	});
});